package generator.config;

import lombok.Data;
import lombok.experimental.Accessors;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * <p>
 *
 * </p>
 *
 * @author angel.bin@aliyun.com
 * @since 2020-10-05 13:54
 */
@Data
@Accessors(chain = true)
public class ComponentConfig {

    private static ComponentConfig componentConfig;

    static {
        try (InputStream in = ComponentConfig.class.getClassLoader().getResourceAsStream("component.properties")) {
            Properties properties = new Properties();
            properties.load(in);
            componentConfig = new ComponentConfig()
                    .setAuthor(properties.getProperty("author"));

        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    private String author;

    public static ComponentConfig getInstance() {
        return componentConfig;
    }

}
